/**
 * 
 */
package unifor.filetransfer;

import java.net.ServerSocket;
import java.net.Socket;

import javax.swing.JProgressBar;
import javax.swing.JTextArea;

import org.swixat.SwiXAT;
/**
 * @author landim
 *
 */
public class Principal {
    
    public static ServerSocket  servidor;
    public static Socket servidorSocket = null;
    public static Socket clienteSocket = null;
    private static JTextArea log = null;
    private static JTextArea logTrans = null;
    private static JProgressBar barra = null;

    public static void main(String[] args) {
        SwiXAT.main(new String[]{"context.xml"});
    }
    
    public static void logTrans(String str) {
        logTrans.setText(logTrans.getText() + "\n" + str);
        logTrans.setCaretPosition( logTrans.getDocument().getLength() );
    }
    
    public static void setLogTrans(JTextArea area) {
        logTrans = area;
    }
    public static void log(String str) {
        log.setText(log.getText() + "\n" + str);
        log.setCaretPosition( log.getDocument().getLength() );
    }
    
    public static void setLog(JTextArea area) {
        log = area;
    }
    
    public static void setBarraMax(int valor) {
    	barra.setMaximum(valor);
    }
    public static void zeraBarraMax() {
    	barra.setValue(0);
    }
    
	public static void incrementaEnvio(int valor) {
		barra.setValue(barra.getValue() + valor);
		barra.repaint();
	}
	
	public static void desincrementaEnvio() {
		barra.setValue(barra.getValue() - 1);
	}

	/**
	 * @param barra the barra to set
	 */
	public static void setBarra(JProgressBar barra) {
		Principal.barra = barra;
	}
    
    
}
